<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:ap="http://aplikata.com/facelets" template="/pages/template/main-layout.xhtml">

	<ui:define name="content">
		<t:saveState value="#{evokPatientProfileBean.patient}" />
		<t:saveState value="#{evokPatientProfileBean.birthRegionId}" />
		<t:saveState value="#{evokPatientProfileBean.birthCityId}" />
		<t:saveState value="#{evokPatientProfileBean.birthCityList}" />

		<t:saveState value="#{evokPatientProfileBean.liveRegionId}" />
		<t:saveState value="#{evokPatientProfileBean.liveCityId}" />
		<t:saveState value="#{evokPatientProfileBean.liveCityList}" />

		<h:panelGrid columns="1" cellpadding="3" width="100%">

			<h:panelGrid width="100%" id="pnlinfo">
				<p:commandButton value="#{msgs.button_submit}" icon="ui-icon-disk"
					onclick="return validator('paitentInfo:basicinfo,paitentInfo:patientContact')" style="float:right;"
					actionListener="#{evokPatientProfileBean.submitPatient}" update=":mainform" />

				<h:inputHidden value="#{evokPatientProfileBean.patient.id}" />

				<p:tabView id="paitentInfo" activeIndex="#{evokPatientProfileBean.tabIndex}">
					<p:tab title="#{msgs.default_basic_data}" id="basicinfo">
						<ui:include src="profile_basic.xhtml" />
					</p:tab>

					<p:tab title="#{msgs.default_contact_data}" id="patientContact">
						<ui:include src="profile_contact.xhtml" />
					</p:tab>

					<p:tab title="#{msgs.evok_patient_contactPerson}"
						rendered="#{evokPatientProfileBean.patient.id != null and evokPatientProfileBean.patient.id > 0  }">
						<ui:include src="profile_contact_person.xhtml" />
					</p:tab>
				</p:tabView>
			</h:panelGrid>
		</h:panelGrid>
	</ui:define>

	<ui:define name="dialog">
		<h:panelGrid>
			<p:confirmDialog message="#{msgs.info_sure_delete}" width="200" showEffect="explode"
				hideEffect="explode" header="POZOR" severity="alert" widgetVar="confirmContactPerson"
				modal="true">

				<p:commandButton value="DA" update=":mainform:paitentInfo:pnlContactPerson,:messages"
					actionListener="#{evokPatientProfileBean.deleteContactPerson}"
					oncomplete="confirmContactPerson.hide()" />

				<p:commandButton value="NE" onclick="confirmContactPerson.hide()" type="button" />
			</p:confirmDialog>
		</h:panelGrid>
	</ui:define>
</ui:composition>
